<html>
<head><meta charset="utf-8"><title>Dynamically avoiding atomics · t-compiler/wg-parallel-rustc · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/187679-t-compiler/wg-parallel-rustc/index.html">t-compiler/wg-parallel-rustc</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/187679-t-compiler/wg-parallel-rustc/topic/Dynamically.20avoiding.20atomics.html">Dynamically avoiding atomics</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="185615687"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187679-t-compiler/wg-parallel-rustc/topic/Dynamically%20avoiding%20atomics/near/185615687" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/187679-t-compiler/wg-parallel-rustc/topic/Dynamically.20avoiding.20atomics.html#185615687">(Jan 14 2020 at 17:00)</a>:</h4>
<p>So I've been doing some profiling and I recalled <a href="https://snf.github.io/2019/02/13/shared-ptr-optimization/" target="_blank" title="https://snf.github.io/2019/02/13/shared-ptr-optimization/">reading a recent article</a> about how glibc C++ avoids using atomics in <code>std::shared_ptr</code> sometimes</p>



<a name="185615693"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187679-t-compiler/wg-parallel-rustc/topic/Dynamically%20avoiding%20atomics/near/185615693" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/187679-t-compiler/wg-parallel-rustc/topic/Dynamically.20avoiding.20atomics.html#185615693">(Jan 14 2020 at 17:00)</a>:</h4>
<p>I was wondering, we can probably do the same for rustc itself</p>



<a name="185615733"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187679-t-compiler/wg-parallel-rustc/topic/Dynamically%20avoiding%20atomics/near/185615733" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/187679-t-compiler/wg-parallel-rustc/topic/Dynamically.20avoiding.20atomics.html#185615733">(Jan 14 2020 at 17:01)</a>:</h4>
<p>All the utilities that we have in the sync module (which currently multiplex single/multi threaded at compile time) we could update to work in both worlds dynamically</p>



<a name="185615766"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187679-t-compiler/wg-parallel-rustc/topic/Dynamically%20avoiding%20atomics/near/185615766" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/187679-t-compiler/wg-parallel-rustc/topic/Dynamically.20avoiding.20atomics.html#185615766">(Jan 14 2020 at 17:01)</a>:</h4>
<p>basically before anything is done a "very fast read" happens which indicates whether an atomic or single-threaded update should happen</p>



<a name="185615783"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187679-t-compiler/wg-parallel-rustc/topic/Dynamically%20avoiding%20atomics/near/185615783" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/187679-t-compiler/wg-parallel-rustc/topic/Dynamically.20avoiding.20atomics.html#185615783">(Jan 14 2020 at 17:01)</a>:</h4>
<p>we would only enable atomics once a thread is spawned, or a second jobserver token is acquired</p>



<a name="185615871"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187679-t-compiler/wg-parallel-rustc/topic/Dynamically%20avoiding%20atomics/near/185615871" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/187679-t-compiler/wg-parallel-rustc/topic/Dynamically.20avoiding.20atomics.html#185615871">(Jan 14 2020 at 17:02)</a>:</h4>
<p>this in theory might be a strategy to land everything <em>today</em> and only selectively enable rayon/extra parallelism as we become confident over time</p>



<a name="185615879"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187679-t-compiler/wg-parallel-rustc/topic/Dynamically%20avoiding%20atomics/near/185615879" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/187679-t-compiler/wg-parallel-rustc/topic/Dynamically.20avoiding.20atomics.html#185615879">(Jan 14 2020 at 17:02)</a>:</h4>
<p>but we could immediately start getting benefits like a truly parallel codegen backend</p>



<a name="185615911"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187679-t-compiler/wg-parallel-rustc/topic/Dynamically%20avoiding%20atomics/near/185615911" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/187679-t-compiler/wg-parallel-rustc/topic/Dynamically.20avoiding.20atomics.html#185615911">(Jan 14 2020 at 17:02)</a>:</h4>
<p>Basically what I'm wondering is whether we can land something like this, basically removing all compile-time checks in the rustc data structures for <code>parallel_compiler</code>, instead changing them to all runtime checks (cheap ones)</p>



<a name="185615937"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187679-t-compiler/wg-parallel-rustc/topic/Dynamically%20avoiding%20atomics/near/185615937" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/187679-t-compiler/wg-parallel-rustc/topic/Dynamically.20avoiding.20atomics.html#185615937">(Jan 14 2020 at 17:03)</a>:</h4>
<p>that may have such a small impact we could land it immediately, and we could unblock a lot of work that's waiting for parallel rustc to get fully enabled</p>



<a name="185615955"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187679-t-compiler/wg-parallel-rustc/topic/Dynamically%20avoiding%20atomics/near/185615955" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/187679-t-compiler/wg-parallel-rustc/topic/Dynamically.20avoiding.20atomics.html#185615955">(Jan 14 2020 at 17:03)</a>:</h4>
<p>(things like the default for <code>-Zthreads</code> would still be conditioned at compile time on <code>parallel_compiler</code> perhaps)</p>



<a name="185634059"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187679-t-compiler/wg-parallel-rustc/topic/Dynamically%20avoiding%20atomics/near/185634059" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/187679-t-compiler/wg-parallel-rustc/topic/Dynamically.20avoiding.20atomics.html#185634059">(Jan 14 2020 at 20:00)</a>:</h4>
<p>So basically we'd make the primitives etc always require Send/Sync then? That's the main "blocker" I see -- but one other thought is that I'm not sure it's worth the hassle</p>



<a name="185634083"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187679-t-compiler/wg-parallel-rustc/topic/Dynamically%20avoiding%20atomics/near/185634083" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/187679-t-compiler/wg-parallel-rustc/topic/Dynamically.20avoiding.20atomics.html#185634083">(Jan 14 2020 at 20:00)</a>:</h4>
<p>i.e., I feel like we're pretty close to being able to just turn it on without this</p>



<a name="185637408"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187679-t-compiler/wg-parallel-rustc/topic/Dynamically%20avoiding%20atomics/near/185637408" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/187679-t-compiler/wg-parallel-rustc/topic/Dynamically.20avoiding.20atomics.html#185637408">(Jan 14 2020 at 20:35)</a>:</h4>
<p>well not so much that they would also require Send/Sync they'd just always conditionally be Send/Sync</p>



<a name="185637464"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187679-t-compiler/wg-parallel-rustc/topic/Dynamically%20avoiding%20atomics/near/185637464" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/187679-t-compiler/wg-parallel-rustc/topic/Dynamically.20avoiding.20atomics.html#185637464">(Jan 14 2020 at 20:36)</a>:</h4>
<p>and also, I should clarify, this was borne out of some thinking about our current state of affairs</p>



<a name="185637483"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187679-t-compiler/wg-parallel-rustc/topic/Dynamically%20avoiding%20atomics/near/185637483" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/187679-t-compiler/wg-parallel-rustc/topic/Dynamically.20avoiding.20atomics.html#185637483">(Jan 14 2020 at 20:36)</a>:</h4>
<p>and I realized that if you already have a fully parallel build, as is likely the case on a small number of cpu machines, then you are basically guaranteed to regress</p>



<a name="185637499"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187679-t-compiler/wg-parallel-rustc/topic/Dynamically%20avoiding%20atomics/near/185637499" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/187679-t-compiler/wg-parallel-rustc/topic/Dynamically.20avoiding.20atomics.html#185637499">(Jan 14 2020 at 20:36)</a>:</h4>
<p>the only improvement we offer is if you have idle parallelism we can gobble that up with a parallel rustc, but times like the start of a full build or most of the build on a small number of cores, have no idle parallelism</p>



<a name="185637517"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187679-t-compiler/wg-parallel-rustc/topic/Dynamically%20avoiding%20atomics/near/185637517" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/187679-t-compiler/wg-parallel-rustc/topic/Dynamically.20avoiding.20atomics.html#185637517">(Jan 14 2020 at 20:37)</a>:</h4>
<p>so you're paying the cost of all this synchronization when none of it actually gets used</p>



<a name="185637531"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187679-t-compiler/wg-parallel-rustc/topic/Dynamically%20avoiding%20atomics/near/185637531" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/187679-t-compiler/wg-parallel-rustc/topic/Dynamically.20avoiding.20atomics.html#185637531">(Jan 14 2020 at 20:37)</a>:</h4>
<p>so my initial thinking was that this is what we may want long-term, not only for the immediate short term to land things</p>



<a name="185637544"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187679-t-compiler/wg-parallel-rustc/topic/Dynamically%20avoiding%20atomics/near/185637544" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/187679-t-compiler/wg-parallel-rustc/topic/Dynamically.20avoiding.20atomics.html#185637544">(Jan 14 2020 at 20:37)</a>:</h4>
<p>becuase this would, in theory, drastically mitigate the cost of a parallel compiler</p>



<a name="185639194"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187679-t-compiler/wg-parallel-rustc/topic/Dynamically%20avoiding%20atomics/near/185639194" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/187679-t-compiler/wg-parallel-rustc/topic/Dynamically.20avoiding.20atomics.html#185639194">(Jan 14 2020 at 20:55)</a>:</h4>
<p>That is true</p>



<a name="185639257"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187679-t-compiler/wg-parallel-rustc/topic/Dynamically%20avoiding%20atomics/near/185639257" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/187679-t-compiler/wg-parallel-rustc/topic/Dynamically.20avoiding.20atomics.html#185639257">(Jan 14 2020 at 20:56)</a>:</h4>
<p>hm, I'm not sure about conditionally Send/Sync</p>



<a name="185639307"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187679-t-compiler/wg-parallel-rustc/topic/Dynamically%20avoiding%20atomics/near/185639307" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/187679-t-compiler/wg-parallel-rustc/topic/Dynamically.20avoiding.20atomics.html#185639307">(Jan 14 2020 at 20:56)</a>:</h4>
<p>They'd need to be Send/Sync unconditionally, right? And we need to be just super careful to avoid spawning threads outside our control if we pursue this</p>



<a name="185639327"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187679-t-compiler/wg-parallel-rustc/topic/Dynamically%20avoiding%20atomics/near/185639327" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/187679-t-compiler/wg-parallel-rustc/topic/Dynamically.20avoiding.20atomics.html#185639327">(Jan 14 2020 at 20:57)</a>:</h4>
<p>(which we probably <em>can</em> do)</p>



<a name="185640464"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187679-t-compiler/wg-parallel-rustc/topic/Dynamically%20avoiding%20atomics/near/185640464" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/187679-t-compiler/wg-parallel-rustc/topic/Dynamically.20avoiding.20atomics.html#185640464">(Jan 14 2020 at 21:09)</a>:</h4>
<p>er, conditional as in <code>impl&lt;T: Send&gt; Send for Lock&lt;T&gt;</code> (or w/e it is)</p>



<a name="185640466"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187679-t-compiler/wg-parallel-rustc/topic/Dynamically%20avoiding%20atomics/near/185640466" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/187679-t-compiler/wg-parallel-rustc/topic/Dynamically.20avoiding.20atomics.html#185640466">(Jan 14 2020 at 21:09)</a>:</h4>
<p>not conditional as in <code>#[cfg]</code></p>



<a name="185641169"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187679-t-compiler/wg-parallel-rustc/topic/Dynamically%20avoiding%20atomics/near/185641169" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/187679-t-compiler/wg-parallel-rustc/topic/Dynamically.20avoiding.20atomics.html#185641169">(Jan 14 2020 at 21:16)</a>:</h4>
<p>ah sure yeah makes sense</p>



<a name="185672257"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187679-t-compiler/wg-parallel-rustc/topic/Dynamically%20avoiding%20atomics/near/185672257" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Zoxc <a href="https://rust-lang.github.io/zulip_archive/stream/187679-t-compiler/wg-parallel-rustc/topic/Dynamically.20avoiding.20atomics.html#185672257">(Jan 15 2020 at 06:29)</a>:</h4>
<p>We could avoid atomic ops if <code>-Z threads=1</code> is passed on the command line. Doing it on demand sounds very tricky though and we'd probably be better off just avoiding atomic ops.</p>



<a name="185706112"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187679-t-compiler/wg-parallel-rustc/topic/Dynamically%20avoiding%20atomics/near/185706112" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/187679-t-compiler/wg-parallel-rustc/topic/Dynamically.20avoiding.20atomics.html#185706112">(Jan 15 2020 at 15:07)</a>:</h4>
<p>My point though is that <code>-Zthreads=1</code> is a static assertion that no threads are used and I don't think it's what we want</p>



<a name="185706175"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187679-t-compiler/wg-parallel-rustc/topic/Dynamically%20avoiding%20atomics/near/185706175" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/187679-t-compiler/wg-parallel-rustc/topic/Dynamically.20avoiding.20atomics.html#185706175">(Jan 15 2020 at 15:08)</a>:</h4>
<p>we are slowing down all rustc instances at the beginning of a very parallel build because they're all doing atomic ops with only one thread now</p>



<a name="185706181"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187679-t-compiler/wg-parallel-rustc/topic/Dynamically%20avoiding%20atomics/near/185706181" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/187679-t-compiler/wg-parallel-rustc/topic/Dynamically.20avoiding.20atomics.html#185706181">(Jan 15 2020 at 15:08)</a>:</h4>
<p>so avoiding the cost may be worth it</p>



<a name="185792034"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187679-t-compiler/wg-parallel-rustc/topic/Dynamically%20avoiding%20atomics/near/185792034" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Zoxc <a href="https://rust-lang.github.io/zulip_archive/stream/187679-t-compiler/wg-parallel-rustc/topic/Dynamically.20avoiding.20atomics.html#185792034">(Jan 16 2020 at 07:35)</a>:</h4>
<p>I guess we can apply the transition only at well defined points where no locks are held and no other threads accessing rustc state exist, which would make it simpler.</p>



<a name="185793370"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187679-t-compiler/wg-parallel-rustc/topic/Dynamically%20avoiding%20atomics/near/185793370" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Zoxc <a href="https://rust-lang.github.io/zulip_archive/stream/187679-t-compiler/wg-parallel-rustc/topic/Dynamically.20avoiding.20atomics.html#185793370">(Jan 16 2020 at 08:07)</a>:</h4>
<p>I wonder if we could have some <code>DynSend</code> and <code>DynSync</code> traits since our types won't really be <code>Send</code> and <code>Sync</code>.</p>



<a name="185810203"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187679-t-compiler/wg-parallel-rustc/topic/Dynamically%20avoiding%20atomics/near/185810203" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Zoxc <a href="https://rust-lang.github.io/zulip_archive/stream/187679-t-compiler/wg-parallel-rustc/topic/Dynamically.20avoiding.20atomics.html#185810203">(Jan 16 2020 at 12:31)</a>:</h4>
<p>We could prevent transition to a parallel state while holding a lock by having a ref count of held locks.</p>



<a name="185835189"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187679-t-compiler/wg-parallel-rustc/topic/Dynamically%20avoiding%20atomics/near/185835189" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/187679-t-compiler/wg-parallel-rustc/topic/Dynamically.20avoiding.20atomics.html#185835189">(Jan 16 2020 at 17:00)</a>:</h4>
<p>So on this topic <span class="user-mention" data-user-id="116122">@simulacrum</span> had a really good idea during the meeting today, which is that <em>if</em> we want to do this work, we should start out with a CLI flag that's "the switch" rather than a dynamic detection of "the switch". It would involve all the same implementation work, just a slightly different condition on what to use. I think that if the cost of the single-threaded, yet parallel-capable, compiler is high enough we can pursue this, but otherwise it's just a fun idea to keep around for awhile</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>